import React, { Component } from 'react'
import { Text, View, StyleSheet, Image, FlatList } from 'react-native'
import Title from './title'
import stus from './stus';
let stu = stus
export default class Team extends Component {

  constructor(props) {
    super(props)
    this.state = {
      stu: stu
    }
  }

  componentDidMount() {
    console.log(stus)
    this.setState({ stus })
  }



  _renderStu = ({ item }) => <View style={styles.userContainer}>
    <Image style={styles.userImg} source={{ uri: "http://johnyu.cn/s183/" + item.img }} />
    <View style={{ padding: 20, flex: 1 }}>
      <Text style={{ fontSize: 30, color: 'balck' }}>姓名：{item.name}</Text>
      <Text style={{ fontSize: 25, color: 'black' }}>学号：{item.sno}</Text>



    </View>
  </View>

  render() {
    return (
      <View>
        <Title />
        <FlatList data={this.state.stus} renderItem={this._renderStu} keyExtractor={stu => stu.id} />
      </View>

    )
  }
}
const styles = StyleSheet.create({
  userContainer: { margin: 1, backgroundColor: 'skyblue', flexDirection: 'row', borderRadius: 20 },
  userImg: { height: 150, width: 100 },
})